<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <script src="/kissy/build/seed-debug.js" charset="utf-8"></script>
    <script src="/kissy/src/package.js"></script>
    <script src="/kissy/src/log.js"></script>
    <style>
        .disable-default-action {
            -webkit-touch-callout: none;
            -webkit-user-select: none;
        }
    </style>
</head>
<body>
<h1>open in ios safari test tap event</h1>

<a href="http://www.g.cn" id="goto">google</a>

<a href="http://www.g.cn" id="goto2">google2</a>

<div id='t' class="disable-default-action" style='
-ms-touch-action:none;
border:1px solid green;width:100px;height:100px;margin:10px'>
    tttt ttttt ttttt tttttt tttttt
</div>

<div id='t2' class="disable-default-action" style='
-ms-touch-action:none;
border:1px solid red;width:100px;height:100px;margin:10px'>
    t2t2t2t2t 2t2t2t2t2t 2t2t2t2t 2t2t2
</div>

<button id="detach">detach t2</button>

<div id="delegate" style="-ms-touch-action:none;">
    <h2>test delegate tap</h2>
    <a href="http://m.taobao.com" id="a-taobao">a taobao</a>
</div>

<div style="height: 900px;"></div>

<script>
    KISSY.use('node,event/gesture/tap', function (S, Node, TapType) {
        var $ = Node.all, t;
        var TAP = TapType.TAP;
        var SINGLE_TAP = TapType.SINGLE_TAP;
        var DOUBLE_TAP = TapType.DOUBLE_TAP;
        var TAP_HOLD = TapType.TAP_HOLD;

        $('#goto').on(TAP, function (e) {
            e.preventDefault();
            log('goto tap');
        });

        $('#t').on(['click', TAP, SINGLE_TAP, DOUBLE_TAP, TAP_HOLD], function (e) {
            log("t: " + e.type);
        });

        $('#t2').on(TAP, t = function (e) {
            log("t2: " + e.type);
        });

        $('#detach').on('click', function () {
            Event.detach('#t2', "tap", t);
        });

        $('#delegate').delegate(TAP, 'a', function (e) {
            e.currentTarget.href = 'javascript:void(0)';
            log(e.currentTarget.id + ' is delegated');
            e.preventDefault();
        });

        alert('ok');
    });
</script>
</body>
</html>